<!--
 * @Author: your name
 * @Date: 2021-12-08 11:26:24
 * @LastEditTime: 2021-12-08 11:29:18
 * @LastEditors: Please set LastEditors
 * @Description: 设备录入
-->
<template>
  <div class="butt-list-sty">
    <div
      v-for="(item, index) in topitemSelectList"
      :key="item.itemTypeId"
      :class="index === itemtypeactive ? 'basebut1' : 'basebut2'"
      @click="itemtypeactive = index"
    >
      <!-- @click="itemtypeactive = index" -->
      {{ item.energyTypeName }}
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      itemtypeactive: 0,
      topitemSelectList: [
        { energyTypeId: 0, energyTypeName: "用电设备" },
        { energyTypeId: 1, energyTypeName: "用水设备" }
      ]
    };
  },
  watch: {
    itemtypeactive(newvalue) {
      this.selbut(newvalue);
    }
  },
  mounted() {
    this.selbut(0);
  },
  methods: {
    selbut(i) {
      this.$emit("topitemtype", this.topitemSelectList[i]["energyTypeId"]);
    }
  }
};
</script>
<style lang="scss" scoped>
.butt-list-sty {
  width: 100%;
  height: 35px;
  display: flex;
  position: relative;
  // top: 50%;
  // transform: translateY(50%);
  flex-direction: row;
}
.basebut1 {
  width: 120px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  // background-color: transparent;
  background-image: linear-gradient(#0fa1d2, #1087af, #106f8f);
  border: #f6f9f9 1px solid;
  border-radius: 15px;
  color: #ffffff;
  cursor: pointer;
  margin: 3px 5px;
  transform: translateY(50%);
}
.basebut2 {
  width: 120px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  background-color: #106986;
  border-radius: 15px;
  color: #ffffff;
  cursor: pointer;
  margin: 3px 5px;
  padding-left: 10px;
  padding-right: 10px;
  transform: translateY(50%);
}
</style>

